<!DOCTYPE HTML>
<html>
<head>
<include file="Include:meta" />
<title>经营数据总览-目的地运营集团数据管理平台</title>
<include file="Include:style" />
</head>
<body>
<include file="Include:header" />
<include file="Include:left" />
<div id="main">
	<div class="crumbs">
		<div class="crumbs-text">经营数据总览</div>
	</div>
	<div id="content">
		<div class="filter">
			<div class="filter-item">
				<div class="filter-title">显示方式：</div>
				<ul class="filter-order">
					<li <if condition="$types eq '图表'">class="current"</if>>
						<a href="__APP__/Project/project_operate_data/types/图表/mon/全部收入/front_year/{$front_year}/front_week/{$front_week}/after_year/{$after_year}/after_week/{$after_week}">图表</a>
					</li>
					<li <if condition="$types eq '列表'">class="current"</if>>
						<a href="__APP__/Project/project_operate_data/types/列表/mode/折叠/front_year/{$front_year}/front_week/{$front_week}/after_year/{$after_year}/after_week/{$after_week}">列表</a>
					</li>
				</ul>
			</div>
			<if condition="$types eq '图表'">
				<div class="filter-item">
					<div class="filter-title">内容分类：</div>
					<ul class="filter-order">
						<li <if condition="$mon eq '全部收入'">class="current"</if>>
							<a href="__APP__/Project/project_operate_data/types/图表/mon/全部收入/front_year/{$front_year}/front_week/{$front_week}/after_year/{$after_year}/after_week/{$after_week}">全部收入</a>
						</li>
						<li <if condition="$mon eq '门票金额'">class="current"</if>>
							<a href="__APP__/Project/project_operate_data/types/图表/mon/门票金额/front_year/{$front_year}/front_week/{$front_week}/after_year/{$after_year}/after_week/{$after_week}">门票金额</a>
						</li>
						<li <if condition="$mon eq '二消金额'">class="current"</if>>
							<a href="__APP__/Project/project_operate_data/types/图表/mon/二消金额/front_year/{$front_year}/front_week/{$front_week}/after_year/{$after_year}/after_week/{$after_week}">二消金额</a>
						</li>
						<li <if condition="$mon eq '成本'">class="current"</if>>
							<a href="__APP__/Project/project_operate_data/types/图表/mon/成本/front_year/{$front_year}/front_week/{$front_week}/after_year/{$after_year}/after_week/{$after_week}">成本</a>
						</li>
					</ul>
				</div>
			<else/>
				<div class="filter-item">
					<div class="filter-title">方式分类：</div>
					<ul class="filter-order">
						<li <if condition="$mode eq '折叠'">class="current"</if>>
							<a href="__APP__/Project/project_operate_data/types/列表/mode/折叠/front_year/{$front_year}/front_week/{$front_week}/after_year/{$after_year}/after_week/{$after_week}">折叠</a>
						</li>
						<li <if condition="$mode eq '展开'">class="current"</if>>
							<a href="__APP__/Project/project_operate_data/types/列表/mode/展开/front_year/{$front_year}/front_week/{$front_week}/after_year/{$after_year}/after_week/{$after_week}">展开</a>
						</li>
					</ul>
				</div>
			</if>
			<div class="search_cont">
				<div class="filter-title">周期选择：</div>
				<select class="form-control w100 start_year">
					<foreach name="year_list" item="yo">
						<option value="{$yo}" <if condition="$yo eq $front_year">selected</if>>{$yo}</option>
					</foreach>
				</select>
				<select class="form-control w100 start_mon">
					<foreach name="front_week_list" item="fo">
					<option value="{$fo['num']}" <if condition="$fo['num'] eq $front_week">selected</if>>{$fo['detail']}</option>
					</foreach>
				</select>
				—
				<select class="form-control w100 end_year">
					<foreach name="year_list" item="yo">
						<option value="{$yo}" <if condition="$yo eq $after_year">selected</if>>{$yo}</option>
					</foreach>
				</select>
				<select class="form-control w100 end_mon">
					<foreach name="after_week_list" item="afo">
					<option value="{$afo['num']}" <if condition="$afo['num'] eq $after_week">selected</if>>{$afo['detail']}</option>
					</foreach>
				</select>
				<button type="button" class="btn search_btn ml10">搜索</button>
				<span class="error-item">起始时间不能大于结束时间</span>
			</div>
		</div>
		<if condition="$types eq '图表'">
			<div class="form-main">
				<div id="echarts" style="width: 100%;height:500px; margin-top: 50px"></div>
			</div>
		<else/>
			<div class="table-scrollx">
				<table class="table table-bordered table-hover">
					<tr class="table-header fixed-table-header">
						<td>项目编号</td>
						<td>项目名称</td>
						<td>期数</td>
						<td colspan="2">门票金额(元)</td>
						<td colspan="2">二消金额(元)</td>
						<td>总收入(元)</td>
						<td colspan="2">成本(元)</td>
					</tr>
					<if condition="$all eq NULL">
					<tr><td class='text-center' colspan="8">暂无相关内容</td></tr>
					</if>
					<if condition="$mode eq '折叠'">
						<foreach name="all" item="ao">
							<foreach name="ao['deta']" item="xo" key="kk">
								<tr>
									<if condition="$kk eq 0">
										<td rowspan="{$ao['rows']}">{$ao['project_num']}</td>
										<td rowspan="{$ao['rows']}">{$ao['project_name']}</td>
									</if>
									<td>{$xo['weeks']}</td>
									<td colspan="2"><if condition="$xo['mp'] neq 0">{$xo['mp']}</if></td>
									<td colspan="2"><if condition="$xo['ec'] neq 0">{$xo['ec']}</if></td>
									<td><if condition="$xo['all'] neq 0">{$xo['all']}</if></td>
									<td><if condition="$xo['cb'] neq 0">{$xo['cb']}</if></td>
								</tr>
							</foreach>
						</foreach>
					<else/>
						<foreach name="all" item="vo">
							<tr>
								<td rowspan="{$vo['rows']}">{$vo['project_num']}</td>
								<td rowspan="{$vo['rows']}">{$vo['project_name']}</td>
								<foreach name="vo['deta']" item="wo">
									<td rowspan="{$wo['row']}">{$wo['weeks']}</td>
									<if condition="$wo['detail'] eq NULL">
										<td colspan="7"></td>
									</tr>
									<else/>
										<foreach name="wo['detail']" item="xo" key="kk">
											<if condition="$kk eq 1">
											<td><b>门票合计</b></td>
											<td><if condition="$wo['mp'] neq 0">{$wo['mp']}</if></td>
											<td><b>二消合计</b></td>
											<td><if condition="$wo['ec'] neq 0">{$wo['ec']}</if></td>
											<td rowspan="{$wo['row']}">{$wo['all']}</td>
											<td><b>成本合计</b></td>
											<td><if condition="$wo['cb'] neq 0">{$wo['cb']}</if></td>
											</tr>
											</if>
											<if condition="$xo['mp_name'] eq NULL">
												<td colspan="2"></td>
											<else/>
												<td>{$xo['mp_name']}</td>
												<td>{$xo['mp_sum']}</td>
											</if>
											<if condition="$xo['ec_name'] eq NULL">
												<td colspan="2"></td>
											<else/>
												<td>{$xo['ec_name']}</td>
												<td>{$xo['ec_sum']}</td>
											</if>
											<if condition="$xo['cb_name'] eq NULL">
												<td colspan="2"></td>
											<else/>
												<td>{$xo['cb_name']}</td>
												<td>{$xo['cb_sum']}</td>
											</if>
										</tr>
										</foreach>
									</if>
							</foreach>
						</foreach>
					</if>
				</table>
			</div>
		</if>
	</div>
</div>
<include file="Include:javascript" />
<script type="text/javascript" src="__PUBLIC__/js/echarts.min.js"></script>
<script type="text/javascript">
	//搜索
	$('.search_btn').click(function(){
		var start_y = parseInt($('.start_year').val()),
			start_m = parseInt($('.start_mon').val()),
			end_y = parseInt($('.end_year').val()),
			end_m = parseInt($('.end_mon').val()),
			tag = true;
		if(start_y>end_y){
			$(this).next('.error-item').show();
			tag = false;
		}else{
			if(start_m>=end_m){
				$(this).next('.error-item').show();
				tag = false;
			}
		}
		if(tag){
			window.location.href="__APP__/Project/project_operate_data/front_year/"+start_y+"/front_week/"+start_m+"/after_year/"+end_y+"/after_week/"+end_m+"/types/{$types}/mon/{$mon}/mode/{$mode}";
		}
	})
	$('select').change(function(){
		$(this).nextAll('.error-item').hide();
	})
	// 基于准备好的dom，初始化echarts实例
	var myChart = echarts.init(document.getElementById('echarts'));
	// 指定图表的配置项和数据
	var myarray={:json_encode($name)};
	var sumss={:json_encode($sumss)};
	var series=[];
	for(var i = 0;i<myarray.length;i++){
		var sd = sumss[i].split(",")
		console.log(sd);
		series.push({
			name: myarray[i],
			type: 'line',
			label: {
				normal: {
					show: true,
					position: 'top'
				}
			},
			data: sd
		});
	}
	var option = {
		title: {
			text: '经营数据',
			subtext: '分析图'
		},
		toolbox: {
			show : true,
			feature : {
				magicType : {show: true, type: ['line', 'bar']},
				restore : {show: true},
				saveAsImage : {show: true}
			}
		},
		color: [{$color}],
		tooltip : {
			trigger: 'axis',
			axisPointer : {            // 坐标轴指示器，坐标轴触发有效
				type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
			}
		},
		legend: {
			data:[{$legend}]
		},
		grid: {
			left: '3%',
			right: '4%',
			bottom: '3%',
			containLabel: true
		},
		xAxis : [
			{
				type : 'category',
				data : [{$weeks}],
				axisTick: {
					alignWithLabel: true
				}
			}
		],
		yAxis : [
			{
				type : 'value'
			}
		],
		"grid": {
			"borderWidth": 0,
			"top": 110,
			"bottom": 115,
			textStyle: {
				color: "#fff"
			}
		},
		"dataZoom": [{
			"show": true,
			"height": 30,
			"xAxisIndex": [
				0
			],
			bottom: 30,
			"start": 0,
			"end": 100,
			
			handleSize: '110%',
			handleStyle:{
				color:"#f49900",
				
			},
			textStyle:{
				color:"#000"},
			borderColor:"#fff"
			
			
		},{
			"type": "inside",
			"show": true,
			"height": 15,
			"start": 1,
			"end": 35
		}],
		series : series
	};
	window.onresize = myChart.resize;
	// 使用刚指定的配置项和数据显示图表。
	myChart.setOption(option);
</script>
</body>
</html>